//
//  STCommdityCollectionViewCell.m
//  赛拓
//
//  Created by 王磊 on 8/15/16.
//  Copyright © 2016 立金所. All rights reserved.
//

#import "STCommdityCollectionViewCell.h"
#import "STCommodityBean.h"
@interface STCommdityCollectionViewCell()

@property (nonatomic ,strong) UIImageView *imageView;

@property (nonatomic ,strong) UILabel *introduceLabel;

@property (nonatomic ,strong) UILabel *timeLabel;

@property (nonatomic ,strong) UILabel *priceLabel;

@property (nonatomic ,strong) STCommodityBean *goods;

@end
@implementation STCommdityCollectionViewCell

- (void)updateData:(id)data {
    
    STCommodityBean *goods = data;
    
    self.goods = goods;
    
    [self.imageView set_BGBannerImageViewWithString:goods.imgUrl];
    
    self.introduceLabel.text = goods.name;
    
    self.timeLabel.text = goods.time;
    
    self.priceLabel.text = goods.price;
    
    self.imageView.frame = CGRectMake(0, 0, self.k_width, self.k_width);
    
    self.introduceLabel.hidden = false;
    
    self.priceLabel.hidden = false;
    
    self.timeLabel.hidden = false;
    
}
- (void)configSubViews {
    [super configSubViews];
    UIImageView *imageView = [[UIImageView alloc]init];
    
    self.imageView = imageView;
    
    [self addSubview:imageView];
    
    UILabel *introduceLabel = [[UILabel alloc]init];
    
    introduceLabel.textAlignment = NSTextAlignmentLeft;
    
    introduceLabel.font = ST_13_FONT;
    
    self.introduceLabel = introduceLabel;
    
    [self addSubview:introduceLabel];
    
    UILabel *timeLabel = [[UILabel alloc]init];
    
    timeLabel.textAlignment = NSTextAlignmentRight;
    
    timeLabel.font = ST_12_FONT;
    
    self.timeLabel = timeLabel;
    
    [self addSubview:timeLabel];
    
    UILabel *priceLabel = [[UILabel alloc]init];
    
    priceLabel.textAlignment = NSTextAlignmentLeft;
    
    priceLabel.font = ST_13_FONT;
    
    self.priceLabel = priceLabel;
    
    [self addSubview:priceLabel];
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.introduceLabel.hidden = false;
    
    self.priceLabel.hidden = false;
    
    self.timeLabel.hidden = false;
    
    self.imageView.frame = CGRectMake(0, 0, self.k_width, self.k_width);
    
    self.introduceLabel.frame = CGRectMake(10, CGRectGetMaxY(self.imageView.frame), self.k_width - 20, 20);
    
    NSLog(@"%f ====== %f== ====== ,",self.k_width ,self.k_height);
    
    self.timeLabel.frame = CGRectMake(10, CGRectGetMaxY(self.introduceLabel.frame), self.k_width - 20, 20);
    
    self.priceLabel.frame = CGRectMake(10, CGRectGetMaxY(self.introduceLabel.frame), self.k_width - 20, 20);
    self.introduceLabel.hidden = false;
    
    self.priceLabel.hidden = false;
    
    self.timeLabel.hidden = false;
    
    self.imageView.frame = CGRectMake(0, 0, self.k_width, self.k_width);
    
    self.introduceLabel.frame = CGRectMake(10, CGRectGetMaxY(self.imageView.frame), self.k_width - 20, 20);
    
    self.timeLabel.frame = CGRectMake(10, CGRectGetMaxY(self.introduceLabel.frame), self.k_width - 20, 20);
    
    self.priceLabel.frame = CGRectMake(10, CGRectGetMaxY(self.introduceLabel.frame), self.k_width - 20, 20);    //
}


@end
